<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改子库存查询')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-viewStock-edit" th:object="${basStock}">
<!--            <input name="stockId" th:field="*{stockId}" type="hidden">-->
            <div class="form-group">    
                <label class="col-sm-3 control-label">子库存编号：</label>
                <div class="col-sm-8">
                    <input name="stockId" th:field="*{stockId}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">货位编码：</label>
                <div class="col-sm-8">
                    <input name="cargoSpaceIdBef" th:value="${basStock.cargoSpaceId}"  hidden readonly required>
                    <input name="cargoSpaceId" th:field="*{cargoSpaceId}" style="width: 90%;float: left" class="form-control" type="text" readonly required>
                    <a id="selectCargoSpace" class="btn btn-success" onclick="selectCargoSpace()"style="float: right" >
                        ...
                    </a>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">货位名称：</label>
                <div class="col-sm-8">
                    <input name="cargoSpaceName" th:field="*{cargoSpaceName}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">sap储位：</label>
                <div class="col-sm-8">
                    <input name="classNowDateTime" th:value="${basStock.sapSpace}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">托盘码：</label>
                <div class="col-sm-8">
                    <input name="trayCode" th:field="*{trayCode}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">库存状态：</label>
                <div class="col-sm-8">
                    <input th:field="*{stockStatus}" name="stockStatus" hidden="hidden">
                    <select name="stockStatus" class="form-control m-b"th:field="*{stockStatus}"readonly disabled>
<!--                        <option th:field="*{stockStatus}"></option>-->
                        <option value="0">正常</option>
                        <option value="1">冻结</option>
                    </select>
                </div>

            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">物料状态：</label>
                <div class="col-sm-8">
                    <input hidden="hidden" name="productStatus"th:field="*{productStatus}" >
                    <select name="productStatus"th:field="*{productStatus}" class="form-control m-b"readonly disabled>
                        <option value="1">待检品</option>
                        <option value="2">合格品</option>
                        <option value="3">不合格品</option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">批号：</label>
                <div class="col-sm-8">
                    <input name="lotNo" th:field="*{lotNo}" class="form-control" type="text"readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">母件编号：</label>
                <div class="col-sm-8">
                    <input name="productId" th:field="*{productId}" class="form-control" type="text"readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">母件名称：</label>
                <div class="col-sm-8">
                    <input name="productName" th:field="*{productName}" class="form-control" type="text"readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">库存数量：</label>
                <div class="col-sm-8">
                    <input name="quantity" th:field="*{quantity}" class="form-control" type="text"readonly>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">子件编号：</label>
                <div class="col-sm-8">
                    <input name="productDetailId" th:field="*{productDetailId}" class="form-control" type="text"readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">子件名称：</label>
                <div class="col-sm-8">
                    <input name="productDetailName" th:field="*{productDetailName}" class="form-control" type="text"readonly>
                </div>
            </div>
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">入库单号：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="stockinId" th:field="*{stockinId}" class="form-control" type="text" readonly>-->
<!--                </div>-->
<!--            </div>-->
            <div class="form-group">    
                <label class="col-sm-3 control-label">仓库编号：</label>
                <div class="col-sm-8">
                    <input hidden="hidden"name="warehouseId"  th:field="*{warehouseId}"  >
                    <select name="warehouseId"  th:field="*{warehouseId}" class="form-control m-b" disabled>
                        <option value="01">立库</option>
                        <option value="02">平库</option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">库存来源：</label>
                <div class="col-sm-8">
                    <input name="stockSource" th:field="*{stockSource}" readonly class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">母件条码：</label>
                <div class="col-sm-8">
                    <input name="barcode" th:field="*{barcode}"readonly class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">子件条码：</label>
                <div class="col-sm-8">
                    <input name="barcodeDetail" th:field="*{barcodeDetail}"readonly class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "stock/stockCheck";
        $("#form-viewStock-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/updateStock", $('#form-viewStock-edit').serialize());
            }
        }
        // 选择货位
        function selectCargoSpace() {
            var options = {
                title: '选择货位',
                url : "/device/basCargoSpace/selectCargoSpaceByWid?status=1&warehouseId=02",
                callBack: getCargoSpace
            };
            $.modal.openOptions(options);
        }

        //关闭物资框
        function getCargoSpace(index, layero) {
            var row = layero.find("iframe")[0].contentWindow.getSelections();
            if (row.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                $.modal.close(index);
                $.modal.closeLoading();
                return;
            }
            $("#cargoSpaceId").val(row[0].cargo_space_id);
            $("#cargoSpaceName").val(row[0].cargo_space_name);
            $.modal.close(index);
            $.modal.closeLoading();
        }

    </script>
</body>
</html>